package com.shopping.www.mapper;

import com.shopping.www.model.Brand;
import com.shopping.www.model.BrandForDelivery;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface DeliveryMapper {
    //查找deliveryStatus=2的商品id
    @Select("select brand_id from user_msg where deliveryStatus=2")
    int[] selectDeliveryIds();
    //根据id查找brand集合
    List<Brand> selectDeliveryBrands(@Param("ids")int[] ids);
    //根据id查找配送数量
    int[] selectDeliveryNums(@Param("ids")int[] ids);
    //根据id查找对应商家的id
    int[] selectDeliveryUserId(@Param("ids")int[] ids);
    //接单之前进行的判断
    int checkDelivery(@Param("delivery_id") int delivery_id,@Param("brand_id")int brand_id);
    //骑手接单
    void takeOrder1(@Param("delivery_id") int delivery_id,@Param("brandForDelivery") BrandForDelivery brandForDelivery);
    //修改deliveryStatus=3
    void takeOrder2(int id);
    //根据delivery_id查找brand_id
    int[] selectWaitDeliveryBrandIds(int delivery_id);
    //根据id查找配送数量
    int[] selectWaitDeliveryNums(@Param("ids")int[] ids);
    //根据id查找delivery_msg的id
    int[] selectWaitDeliveryId(@Param("ids")int[] ids,@Param("delivery_id")int delivery_id);
    //修改delivery_msg的status
    void arriveDelivery1(int id);
    //修改user_msg的deliveryStatus
    void arriveDelivery2(@Param("brandForDelivery") BrandForDelivery brandForDelivery,@Param("id")int id);
}
